﻿var React = require('react');
var ReactDOM = require('react-dom');
var myState = require('../../store/main/state');

//可以控制单个按钮的状态
class GoBtn extends React.Component{
	constructor(props){
		super(props);
		this.state={
			index:0,
		}
		this.clickHandle=this.clickHandle.bind(this);
	}
	
	clickHandle(event){
		console.log(this.state);
		myState.inc();
		this.setState({index:myState.index});
	}
	//<img src=img/{this.state.png} />
	render(){
		return <button onClick={this.clickHandle}>{this.state.index}</button>;
	}
}


ReactDOM.render(
  <GoBtn />,
  document.getElementById('go-container')
);
